home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / scriptinterface.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.7 KB  |  89 lines

  1. /* This file is part of the KDE project
  2.    Copyright (C) 2001 Ian Reinhart Geiser  (geiseri@kde.org)
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License as published by the Free Software Foundation; either
  7.    version 2 of the License, or (at your option) any later version.
  8.  
  9.    This library is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.    Library General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU Library General Public License
  15.    along with this library; see the file COPYING.LIB.  If not, write to
  16.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.    Boston, MA 02110-1301, USA.
  18. */
  19.  
  20. /**
  21. *    \section Generic interface for building scripting engines
  22. *
  23. *    This interface will create a generic API for implementing script engines.
  24. *    These engines can then be accessed from any application that supports this interface.
  25. *
  26. *
  27. **/
  28. #ifndef __scriptinterface_h__
  29. #define __scriptinterface_h__
  30. #include <qvariant.h>
  31. #include <qobject.h>
  32. #include <kdemacros.h>
  33.  
  34. //#include <scripclientinterface.h>
  35. class QString;
  36. class QObject;
  37. class KScriptClientInterface;
  38.  
  39.  
  40. //namespace KScriptInterface
  41. //{
  42.     /**
  43.     *    This class is the base for all script engines.
  44.     *    @author Ian Reinhart Geiser <geiseri@kde.org>
  45.     *
  46.     **/
  47.     class KDE_EXPORT KScriptInterface : public QObject
  48.     {
  49.     Q_OBJECT
  50.     public:
  51.         /**
  52.         *    Return the current script code data
  53.         *    @returns QString containing the currenly runable code
  54.         **/
  55.         virtual QString script() const = 0;
  56.         /**
  57.         *    Sets the path to the script library that we are going to embed.
  58.         **/
  59.         virtual void setScript( const QString &scriptFile ) = 0;
  60.         /**
  61.         *    Sets the path to the script library that we are going to embed.
  62.         *    The second argument is the function from the script library that
  63.         *    we wish to call.
  64.         **/
  65.         virtual void setScript( const QString &scriptLibFile, const QString &method ) = 0;
  66.         /**
  67.         *    Run the actual script code
  68.         *    This can both take a context object that will be shared between the
  69.         *    main application and a variant that will contain the arguments.
  70.         **/
  71.         virtual void run(QObject *context = 0, const QVariant &arg = 0) = 0;
  72.         /**
  73.         *    Abort the scripts run
  74.         **/
  75.         virtual void kill() =0;
  76.     public:
  77.         /**
  78.         *    This is the method for sending feedback to applications.
  79.         *    example of how this works:
  80.         *    \code
  81.         *        ScriptClientInterface->error( message_to_send_back_to_the_main_application );
  82.         *    \endcode
  83.         *    Will send the error message back to the main application.
  84.         **/
  85.         KScriptClientInterface    *ScriptClientInterface;
  86.     };
  87. //};
  88. #endif
  89.